package xyz.hujf.base.interrupted;

/**
 * @author Hujf
 * @title: InterruptedTest2
 * @date 2021-04-2120:29
 * @description: TODO
 */
public class InterruptedTest2 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread1 = new Thread(()->{
           System.out.println("user 1 hour to do work ");
            try {
                Thread.sleep(1000000000);

            } catch (InterruptedException e) {
                System.out.println("exception interrupted by main ");
                return ;
            }
            System.out.println("work is over");
        });


        thread1.start();

        Thread.sleep(1000);

       thread1.interrupt();

        thread1.join();


        System.out.println("Main is over ");
    }
}
